<script>
const cozeIcon = 'https://obs-user-test.obs.cn-east-3.myhuaweicloud.com:443/pictures/test_1747025867_0kFMwpjLOL.png'
export default {
  data() {
    return {
      coze: null,
      cozeAccessToken: ''
    }
  },
  created() {
    document.title = '智能客服'
    const accessToken = this.$route.query?.accessToken
    if (accessToken) {
      this.cozeAccessToken = accessToken
      this.cozeInit()
    }
  },
  mounted() {

  },
  methods: {
    cozeInit() {
      this.coze = new CozeWebSDK.WebChatClient({
        config: {
          bot_id: '7501206380289097738',
          isIframe: false
        },
        componentProps: {
          title: '智能客服'
        },
        auth: {
          type: 'token',
          token: this.cozeAccessToken,
          onRefreshToken: function() {
            return this.cozeAccessToken
          }
        },
        ui: {
          base: {
            icon: cozeIcon,
            layout: 'mobile'
          },
          header: {
            isNeedClose: false
          },
          footer: {
            isShow: false
          },
          chatBot: {
            uploadable: false
          },
          asstBtn: {
            isNeed: false
          }
        }
      })

      this.coze.showChatBot()
    }
  }
}
</script>

<template>
  <div />
</template>

<style scoped lang="scss">

</style>
